﻿using System;
using UDS.Common;

namespace UDS.DBInstaller
{
    public class InstallerArgs : ICmdArgs
    {
        /// <summary>
        /// Get or set the connection string to connect the database.
        /// </summary>
        [Arg("assembly", "a", Description = "Specifies the location of the database assembly.", Required = false, RequiredValue = ArgRequiredValue.Yes)]
        public string AssemblyLocation
        {
            get;
            set;
        }

        /// <summary>
        /// Get or set the connection string to connect the database.
        /// </summary>
        [Arg("connectionstring", "c", Description = "The connection string used for connecting database.", Required = false, RequiredValue = ArgRequiredValue.Yes)]
        public string ConnectionString
        {
            get;
            set;
        }

        #region ICmdArgs Members

        public bool ShowUsage
        {
            get;
            set;
        }

        public void Usage(string errorInfo)
        {
            if (!string.IsNullOrEmpty(errorInfo))
            {
                Console.WriteLine();
                Console.WriteLine(errorInfo);
                Console.WriteLine();
            }
            Console.WriteLine("Usage:");
            Console.WriteLine(ArgParser.Usage(this));
        }

        public void Validate()
        { }

        public void ProcessStandAloneArgument(string arg)
        {
            throw new InvalidArgException(arg);
        }

        #endregion
    }
}
